package com.hoshiicloud.suppplier.feign;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hoshiicloud.common.query.OmnipotentParam;
import com.hoshiicloud.common.query.OmnipotentWrapper;
import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.goods.entity.goods.Gallery;
import com.hoshiicloud.goods.entity.sku.BaseSku;
import com.hoshiicloud.goods.entity.sku.BaseSkuGallery;
import com.hoshiicloud.goods.entity.sku.VendorGoodsSku;
import com.hoshiicloud.goods.entity.spu.BaseGoodsGallery;
import com.hoshiicloud.goods.entity.spu.BaseSpu;
import com.hoshiicloud.goods.param.sku.*;
import com.hoshiicloud.goods.param.spu.BaseSpuAddParam;
import com.hoshiicloud.goods.param.spu.BaseSpuQueryParam;
import com.hoshiicloud.goods.vo.GoodsPropertiesVo;
import com.hoshiicloud.goods.vo.sku.BaseSkuVo;
import com.hoshiicloud.suppplier.feign.hystrix.GoodsFeignServiceFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author qry
 * @date 2019/8/7 18:14

 * 商品发布 模块
 */
@FeignClient(name = "hoshiicloud-goods", fallback = GoodsFeignServiceFallback.class)
public interface GoodsFeignService {


    //-------------------------------------------base_spu-------------------------------------------

    /**
     *  保存baseSpu并返回的  BaseSpu 对象
     * @param param BaseSpuAddParam
     * @return BaseSpu
     */
    @PostMapping("/goods/base-spu/saveBaseSpu")
    Response<BaseSpu> saveBaseSpu(@RequestBody BaseSpuAddParam param);

    /**
     *  通过Id 查询baseSpu信息
     * @param id baseSpuId
     * @return BaseSpu
     */
    @GetMapping("/goods/base-spu/{id}")
    Response<BaseSpu> getBaseSpuById(@PathVariable("id") Long id);

    /**
     *  分页查询供应商发布的商品列表
     * @param param 查询条件
     * @return Page<BaseSpu>
     */
    @PostMapping("/goods/base-spu/query/pageBaseSpuForSupplier")
    Response<Page<BaseSpu>> pageBaseSpuForSupplier(@RequestBody BaseSpuQueryParam param);

    //-------------------------------------------base_goods_gallery-------------------------------------------

    /**
     * 批量保存BaseSpu与相册关联信息
     * @param baseGoodsGalleries 需要保存的关联信息
     * @return true or false
     * */
    @PostMapping("/goods/base-goods-gallery/saveBatch")
    Response<Boolean> saveBaseGoodsGalleryBatch(@RequestBody List<BaseGoodsGallery> baseGoodsGalleries);

    /**
     *  通过baseSpuId 查询相册关联信息
     * @param baseSpuId  基础Spu的Id
     * @return List<BaseGoodsGallery>
     */
    @GetMapping("/goods/base-goods-gallery/listBySpuIds/{baseSpuId}")
    Response<List<BaseGoodsGallery>> listBaseGoodsGalleryBySpuId(@PathVariable("baseSpuId") Long baseSpuId);


    //-------------------------------------------ext_spu-------------------------------------------

    /**
     * 获取某个店铺下商品权重的最大值
     * @param storeId 店铺Id
     * @return 权重值
     */
    @GetMapping("/goods/ext-spu/getMaxWeight")
    Response<Long> getMaxWeight(@RequestParam("storeId") Long storeId);

    //-------------------------------------------spu_sales_category-------------------------------------------

    //-------------------------------------------tags-------------------------------------------

    //-------------------------------------------goods_gallery-------------------------------------------


    //-------------------------------------------gallery-------------------------------------------

    /**
     * 批量保存相册信息
     * @param galleries 需要保存的相册数据
     * @return true or false
     * */
    @PostMapping("/gallery/gallery/saveBatch")
    Response<Boolean> saveGalleryBath(@RequestBody List<Gallery> galleries);

    /**
     *  自定义批量查询相册信息
     * @param param  List<OmnipotentWrapper>
     * @return List<Gallery>
     */
    @PostMapping("/gallery/gallery/queryBatch")
    Response<List<Gallery>> queryGalleryBatch(@RequestBody List<OmnipotentWrapper> param);

    //-------------------------------------------base_sku-------------------------------------------

    /**
     *  保存BaseSku信息, 并返回保存的 BaseSku对象
     * @param param BaseSkuAddParam
     * @return BaseSku
     */
    @PostMapping("/goods/base-sku/saveBaseSku")
    Response<BaseSku> saveBaseSku(@RequestBody BaseSkuAddParam param);

    /**
     * baseSku信息查询
     * @param param 查询条件
     * @return 返回值
     */
    @PostMapping("/goods/base-sku/listByParam")
    Response<List<BaseSkuVo>> listBaseSkuByParam(@RequestBody SkuBaseListParam param);

    //-------------------------------------------base_sku_gallery-------------------------------------------

    /**
     *  保存BaseSku的图片信息
     * @param param BaseSkuGalleryAddParam
     * @return true or false
     */
    @PostMapping("/goods/base-sku-gallery/save")
    Response<Boolean> saveBaseSkuGallery(@RequestBody BaseSkuGalleryAddParam param);

    /**
     *  通过 baseSkuId 获取skuGallery集合
     * @param baseSkuId 基础skuId
     * @return BaseSkuGallery
     */
    @GetMapping("/goods/base-sku-gallery/listByBaseSkuId/{baseSkuId}")
    Response<List<BaseSkuGallery>> listBaseSkuGalleryByBaseSkuId(@PathVariable("baseSkuId") Long baseSkuId);

    //-------------------------------------------ext_sku-------------------------------------------


    //-------------------------------------------prodcut_manage-------------------------------------------

    //-------------------------------------------vendor_goods_sku-------------------------------------------

    /**
     * 保存供应商商品SKU信息
     * @param param VendorGoodsSkuAddParam
     * @return true or false
     */
    @PostMapping("/goods/vendor-goods-sku/save")
    Response<Boolean> saveVendorGoodsSku(@RequestBody VendorGoodsSkuAddParam param);

    /**
     *  根据Id查询供应商商品sku信息
     * @param id vendorGoodsSkuId
     * @return VendorGoodsSku
     */
    @GetMapping("/goods/vendor-goods-sku/{id}")
    Response<VendorGoodsSku> getVendorGoodsSkuById(@PathVariable("id") Long id);

    /**
     *  更新供应商商品SKU信息
     * @param param VendorGoodsSkuUpdateParam
     * @return true or false
     */
    @PutMapping("/goods/vendor-goods-sku/update")
    Response<Boolean> updateVendorGoodsSku(@RequestBody VendorGoodsSkuUpdateParam param);

    /**
     * 通过Id删除 供应商品商品sku 信息
     * @param id 供应商商品Sku 的Id
     * @return true or false
     */
    @DeleteMapping("/goods/vendor-goods-sku/delete/{id}")
    Response<Boolean> deleteVendorGoodsSkuById(@PathVariable("id") Long id);

    /**
     *  通过自定义条件批量更新供应商商品SKU信息(此更新是更新成相同的值)
     * @param params OmnipotentParam<VendorGoodsSku>
     * @return true or false
     */
    @PostMapping("/goods/vendor-goods-sku/updateBatch")
    Response<Boolean> updateVendorGoodsSkuBatch(@RequestBody OmnipotentParam<VendorGoodsSku> params);

    /**
     *  自定义条件查询 供应商商品Sku信息
     * @param param
     * @return
     */
    @PostMapping("/goods/vendor-goods-sku/queryBatch")
    Response<List<VendorGoodsSku>> listVendorGoodsSku(@RequestBody List<OmnipotentWrapper> param);


    //-------------------------------------------goods-properties-------------------------------------------

    /**
     *  通过类目Id和租户Id获取属性信息
     * @param categoryId 类目Id
     * @param companyId 租户Id
     * @return List<GoodsPropertiesVo>
     */
    @GetMapping("/goods/goods-properties/getProperByCateId")
    Response<List<GoodsPropertiesVo>> getProperByCateId(@RequestParam("categoryId") Long categoryId, @RequestParam("companyId") Long companyId);




    //-------------------------------------------public-properties-------------------------------------------

    /**
     * 通过“名称”获取销售单位和包装单位
     * @param companyId 租户Id
     * @param propertyName "包装单位" 或  "销售单位"
     * @return 包装单位或销售单位 值的集合
     */
    @GetMapping("/goods/public-properties/dropdownBox")
    Response<List<String>> dropdownBox(@RequestParam("companyId") Long companyId, @RequestParam("propertyName") String propertyName);


    //-------------------------------------------goods-brand-------------------------------------------

    /**
     * 根据类目id， 查询某个类目下的品牌信息
     * @param cateId 类目Id
     * @return 品牌信息
     */
    @GetMapping("/goods/goods-brand/getBrandCategoryByCateId")
    Response<List<Map<String, Object>>> getGoodsBrandsByCateId(@RequestParam("cateId") Long cateId);

    //-------------------------------------------goods-category-------------------------------------------


    /**
     *  根据三个类目id组成的字符串（需是父子关系），查询类目名称
     * @param categoryContextQueryStr 类目Id的字符串 例如： '1,2,3'
     * @return 类目的中文名称 名称以 > 的形式分隔
     */
    @GetMapping("/goods/goods-category/getCategoryContext")
    Response<String> getCategoryContext(@RequestParam("categoryContextQueryStr") String categoryContextQueryStr);


}
